package com.pug.service;

import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/3/19$ 17:35$
 */
public interface MongoBaseService extends BaseService {

    /**
     * @param clz
     * @param <T>
     * @param <R>
     * @return
     */
    default <T, R> Page<R> tranferPageMongoBo(Page<T> poPage, Class<R> clz) {
        List<R> hotelBos = tranferListBo(poPage.getContent(), clz);
        Page<R> boPage = new PageImpl<R>(hotelBos, poPage.getPageable(), poPage.getTotalElements());
        return boPage;
    }
}
